<?php

/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Sitealbum
 * @copyright  Copyright 2010-2011 BigStep Technologies Pvt. Ltd.
 * @license    http://www.socialengineaddons.com/license/
 * @version    $Id: Controller.php 2011-08-026 9:40:21Z SocialEngineAddOns $
 * @author     SocialEngineAddOns
 */
class Sitealbum_Widget_FeaturedAlbumsSlideshowController extends Engine_Content_Widget_Abstract {

  public function indexAction() {
    // List of featured album
    $table = Engine_Api::_()->getItemTable('album');
    $select = $table->select()
                    ->where('search = ?', true)
                    ->where("featured = ?", 1);
    $limit = $this->_getParam('itemCountPerPage', 10);
    $select->limit($limit);
    $this->view->show_slideshow_object = $this->view->featuredAlbums = $featuredAlbums = $table->fetchAll($select);
		$featuredAlbum = Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.featuredalbum', null);
    // Count Featured Albums
    $this->view->num_of_slideshow = count($featuredAlbums);
    // Number of the result.
    if (empty($this->view->num_of_slideshow) || empty($featuredAlbum)) {
      return $this->setNoRender();
    }
  }

}
?>